﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Common;
using System.Data.SqlClient;
using System.Text;
using Wangzeran.CodeMaker.Core.DB;

namespace Wangzeran.CodeMaker.PlugIns.DB.SQLServer2000
{
    public class SQLServerUtility : IDBUtility
    {

        #region IDBUtility 成员

        /// <summary>
        /// 数据库连接字符串
        /// </summary>
        private static string m_ConnectionString = null;

        public string ConnectionString
        {
            get
            {
                if (m_ConnectionString == null)
                {
                    m_ConnectionString = 
                        ConfigurationManager.ConnectionStrings["mssql2000"].ConnectionString;
                }
                return m_ConnectionString;
            }
            set
            {
                m_ConnectionString = value;
            }
        }

        public DbConnection GetConnection()
        {
            try
            {
                return new SqlConnection(ConnectionString);
            }
            catch (Exception ex)
            {	
                throw ex;
            }
        }

        public void CloseConnection()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
